Skip to content

Removed PhotosAddOnly permission request within MediaPicker.ios#34287

Open
Kyranio wants to merge 1 commit intodotnet:mainfrom
Kyranio:net10-34246
Open

Removed PhotosAddOnly permission request within MediaPicker.ios#34287
Kyranio wants to merge 1 commit intodotnet:mainfrom
Kyranio:net10-34246

Conversation

@Kyranio
Copy link

@Kyranio Kyranio commented Feb 27, 2026

Description of Change

Removed permission request for adding photos to the devices library on iOS, inside MediaPicker.ios, which doesn't need this permission at this spot inside the code as it does not add the newly captured photo to the device's library here.

Given the official documentation, adding the picture to the device's library is an action given in the example after the CapturePhotoAsync is called, if the task's result contains a value.
This action is completely optional, the developer could implement different logic for handling the picture data after calling CapturePhotoAsync, meaning the permission request becomes unnecessary and redundant.

It is up to the developer to save the image to the device, which then requires the permission, meaning the developer should implement the permission request within their own logic.

Issues Fixed

Fixes #34246

Permission request for adding photos to device library in MediaPicker.ios
@github-actions
Copy link
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34287

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34287"

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Feb 27, 2026
@dotnet-policy-service
Copy link
Contributor

Hey there @@Kyranio! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@jfversluis
Copy link
Member

It is up to the developer to save the image to the device, which then requires the permission, meaning the developer should implement the permission request within their own logic.

While that might be true, doesn't our implementation always save it to the gallery on iOS? We don't have an option to set the right now (see #30439), so because of that, we also need to have this permission now. If we make that optional for .NET 11, then we can make this permission optional as well

@Kyranio
Copy link
Author

Kyranio commented Mar 2, 2026

While that might be true, doesn't our implementation always save it to the gallery on iOS?

If that is the case, then this might actually be a bug instead, as a photo taken with iOS (handled with MediaPicker) does in fact not save it to the gallery. The source code of the MediaPicker PhotoAsync method itself does not contain any logic indicating that the image is to be saved to the device itself, nor to it's gallery... which was why I initially posted the issue #34246 (under a different account, related to the company I work for) and created this pullrequest.

It's also why I referenced the official documentation which contains a code-snippet, suggesting that a developer needs to save the image to the device after calling CapturePhotoAsync themselves, in their own code. This in itself led me to believe that requesting the permission shouldn't be within the PhotoAsync method but rather within the user's own code.

If the PhotoAsync task should save the picture to the device's gallery regardless, the documentation would probably need to be updated. The PhotoAsync method might need to be looked at, however, as in our experience it does not add the pictures to the gallery by itself...
But maybe the MediaPicker isn't implemented correctly in our own code; we are all human too after all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS MediaPicker CapturePhotoAsync without "PhotosAddOnly" permission

2 participants